package com.liner.homework.first;

public class RefArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[2];
        Chick[] chicks = new Chick[3];
        Fish[] fish = new Fish[2];

        dogs[0] = new Dog("大黄", 3, "黄色");
        dogs[1] = new Dog("旺财", 4, "橘色");

        fish[0] = new Fish("金鱼", 3, "金色");
        fish[1] = new Fish("鲨鱼", 12, "蓝色");

        chicks[0] = new Chick("小美", 4, "粉色");
        chicks[1] = new Chick("小绿", 5, "绿色");
        chicks[2] = new Chick("小白", 6, "白色");

        for (Dog dog : dogs) {
            System.out.println(dog.name + " " + dog.age + " " + dog.color);
            dog.eat();
            dog.drink();
            dog.lookHome();
        }

        for (Chick chick : chicks) {
            System.out.println(chick.name + " " + chick.age + " " + chick.color);
            chick.eat();
            chick.drink();
            chick.layEggs();
           }

        for (Fish fish1 : fish) {
            System.out.println(fish1.name + " " + fish1.age + " " + fish1.color);
            fish1.eat();
            fish1.drink();
            fish1.swim();
        }




    }
}
